package com.wk.item;

import org.junit.jupiter.api.Test;

import java.util.concurrent.CompletableFuture;

public class test {

    @Test
    public void futureTest(){
        CompletableFuture.supplyAsync(()->{

            System.out.println("执行业务方法");

            int i = 1/0;

            return "返回值";
        }).whenComplete((t,u)->{
            System.out.println("获取返回值 = " + t);
            System.out.println("异常信息 = " + u);
        });
    }

}
